import SwiftUI

class BudgetStore: ObservableObject {
    @Published var budgets: [Budget] = Budget.sampleBudgets

    func applyExpense(_ expense: Expense) {
        if let index = budgets.firstIndex(where: { $0.category == expense.category }) {
            budgets[index].expenses.append(expense)
        }
    }

    func addBudget(_ budget: Budget) {
        budgets.append(budget)
    }
}
